home *** CD-ROM | disk | FTP | other *** search
/ The Very Best of Atari Inside / The Very Best of Atari Inside 1.iso / mint / mntlib43 / mntlib / console.c < prev    next >
C/C++ Source or Header  |  1993-07-06  |  708b  |  46 lines

  1. /* console I/O routines */
  2. /* written by Eric R. Smith, placed in the public domain */
  3.  
  4. /* BUGS: under TOS, all tty input is assumed to come from the keyboard
  5.  * (unless we can figure out otherwise)
  6.  */
  7.  
  8. #include <osbind.h>
  9. #include <mintbind.h>
  10. #include <support.h>
  11.  
  12. #define CTRL(x) (x & 0x1f)
  13. #define CBUFSIZ 80
  14.  
  15. extern int __mint;
  16.  
  17. int
  18. _console_read_byte(fd)
  19.     int fd;
  20. {
  21.     short f;
  22.  
  23.     if (__mint) {
  24.         return (int)Fgetchar(fd, 0);
  25.     }
  26.     if (fd == 0)
  27.         return (int)Crawcin();
  28.     if (fd == 2)
  29.         return (int)Cauxin();
  30.  
  31.     f = fd;
  32.     if (f < 0 && f >= -3)
  33.         return (int)Bconin(f+3);
  34.     return (int)Bconin(2);
  35. }
  36.  
  37. void
  38. _console_write_byte(fd, outc)
  39.     int fd, outc;
  40. {
  41.     unsigned char c;
  42.  
  43.     c = outc;
  44.     (void)Fwrite(fd, 1L, &c);
  45. }
  46.